<?php

$server = new Swoole\Server('127.0.0.1','9501');

$server->on('Connect', function($server, $fd){
    echo 'tcp connect:'.$fd;
});


$server->on('Receive', function($server, $fd, $reactor_id, $data){
    $server->send($fd, 'receive data'.$data);
});

$server->on('Close', function($server, $fd) {
    echo 'Close :'.$fd;
});

$server->start();